import http.client,unittest,HTMLTestRunner,pymysql,json,re
class a :
    def test_login(self):
        con = http.client.HTTPConnection("localhost",80)
        con.request(method="POST",url="/agileone/index.php/common/login",
                    body="username=admin&password=admin&savelogin=true",
                    headers={"Content-Type":" application/x-www-form-urlencoded"})
        # res = con.getresponse().read().decode()
        # print(res)
        cook = con.getresponse().getheader("Set-Cookie")
        #print(cook)
        cookie = cook.split(";")[0]
        print(cookie)
        con = http.client.HTTPConnection("localhost",80)
        con.request(method="POST",url="/agileone/index.php/proposal/add",
                    body="type=Requirement&importance=Medium&headline=title123&content=test1111111111111111111&processresult=",
                    headers={"Content-Type":" application/x-www-form-urlencoded",
                             "Cookie":cookie})
        print(1)
if __name__ == "__main__":
    a().test_login()